﻿<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>客户列表</title>
    <#--引入的一些核心文件-->
    <#include "../common/link.ftl">
    <script>
    </script>
</head>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <#include "../common/navbar.ftl">
    <#assign currentMenu="customer">
    <#include "../common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>客户列表</h1>
        </section>
        <section class="content">
            <div class="box">
                <form class="form-inline" id="searchForm" action="/customer/list.do" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <div class="form-group">
                        <label for="keyword">关键字:</label>
                        <input type="text" class="form-control" id="keyword" name="keyword" value="${qo.keyword!}" placeholder="请输入姓名/电话">
                    </div>
                    <#--通过客户状态查询客户 下拉框-->
                    <div class="form-group">
                        <label for="sellerId"> 客户状态:</label>
                        <select class="form-control" id="status" name="status">
                            <option value="-1">全部</option>
                                <#list map?keys as key>
                                    <option value="${key}">${map[key]}</option>
                                </#list>
                        </select>
                    <#--查询时回显选中的状态-->
                        <script>
                            $('#status').val(${qo.status});
                        </script>
                    </div>
                <#--通过销售人员查询下拉框-->
                    <#--销售人员下拉框,是提供给管理员或者经理用的, 不应该给普通销售员看到-->
                    <div class="form-group">
                        <label for="sellerId"> 销售员:</label>
                        <select class="form-control" id="sellerId" name="sellerId">
                            <option value="-1">全部</option>
                                <#list employees as e>
                                    <option value="${e.id}">${(e.name)!}</option>
                                </#list>
                        </select>
                    <#--查询时回显选中的销售员-->
                        <script>
                            $('#sellerId').val(${qo.sellerId});
                        </script>
                    </div>
                    <button id="btn_query" class="btn btn-primary"><span class="glyphicon glyphicon-search"></span> 查询</button>
                </form>
                <!--编写内容-->
                <div class="box-body table-responsive no-padding ">
                    <table class="table table-hover table-bordered">
                        <tr>
                            <th>编号</th>
                            <th>姓名</th>
                            <th>电话</th>
                            <th>QQ</th>
                            <th>职业</th>
                            <th>来源</th>
                            <th>销售员</th>
                            <th>状态</th>
                        </tr>
                        <#list result.list as customer>
                            <tr>
                                <#--取值后面加个感叹号可以解决空指针问题,也可以感叹后加个默认值-->
                                <td>${customer_index+1}</td>
                                <td>${customer.name!}</td>
                                <td>${customer.tel!}</td>
                                <td>${customer.qq!}</td>
                                <td>${(customer.job.title)!}</td>
                                <td>${(customer.source.title)!}</td>
                                <td>${(customer.seller.name)!}</td>
                                <td>${customer.statusName!}</td>
                            </tr>
                        </#list>
                    </table>
                    <!--分页-->
                    <#include "../common/page.ftl">
                </div>
            </div>
        </section>
    </div>
        <#--引入主页面的底部(一些公司的信息)-->
    <#include "../common/footer.ftl">
</div>
</body>
</html>
